<?php
class RegisterForm extends Zend_Form {
	
    public function init() {
        $this->setMethod("POST");
        $this->setName("registerForm");
        
        $element = new Zend_Form_Element_Text("email");
        $element->setLabel("Email:");
        $element->setDescription("Your email address");
        $element->setRequired(true);
        $element->addValidator(new Zend_Validate_EmailAddress());
        $element->addFilter(new Zend_Filter_HtmlEntities());
        $element->addFilter(new Zend_Filter_StripTags());
        $element->addValidator('NotEmpty');
        $this->addElement($element);
              
        $element = new Zend_Form_Element_Text("name");
        $element->setLabel("Name");
        $element->setDescription("Better to be the real name to get more trust :D");
        $this->addElement($element);
        
        $element = new Zend_Form_Element_Password("password");
        $element->setLabel("Password");
        $element->setDescription("At least 6 characters");
        $element->addValidator(new Zend_Validate_StringLength(6,100));
        $element->addFilter(new Zend_Filter_HtmlEntities());
        $element->addFilter(new Zend_Filter_StripTags());
        $this->addElement($element);
        
        $element = new Zend_Form_Element_Select("country");
        $element->setLabel("Country");
        $element->addMultiOption(0, "-- Select country --");
        $element->addMultiOptions(Country::getAllCountryAsArray());
        $this->addElement($element);
        
        $element = new Zend_Form_Element_Select("city");
        $element->setLabel("City");
        $element->addMultiOptions(array(
            "0" => "-- Select city --"
        ));
        $element->setRegisterInArrayValidator(false);
        $this->addElement($element);
        
        $element = new Zend_Form_Element_Select("region");
        $element->setLabel("Region");
        $element->addMultiOptions(array("0"=>"-- Select Region --"));
        $element->setRegisterInArrayValidator(false);
        $this->addElement($element);
        
        $element = new Zend_Form_Element_Submit("register");
        $this->addElement($element);
    }
}
?>